Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repository - add support for mirroring_policy for Katello 4.4+ #1392

Merged
merged 1 commit into from
Apr 29, 2022

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Apr 29, 2022

Fixes: #1388

Copy link
Member

@mdellweg mdellweg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you'd use the wrong parameter for your installation, the payload validation would complain, right?

@evgeni evgeni force-pushed the mirroring-policy branch from 3df53fb to e97c422 Compare April 29, 2022 08:18
@evgeni
Copy link
Member Author

evgeni commented Apr 29, 2022

If you'd use the wrong parameter for your installation, the payload validation would complain, right?

You mean if a user will set mirroring_policy on a pre-4.4 install? or mirror_on_sync in 4.6+? Yeah, this will yield a warning "not supported by your server":

def _validate_supported_payload(self, resource, action, payload):
"""
Check whether the payload only contains supported keys.
Emits a warning for keys that are not part of the apidoc.
:param resource: Plural name of the api resource to check
:type resource: str
:param action: Name of the action to check payload against
:type action: str
:param payload: API paylod to be checked
:type payload: dict
:return: The payload as it can be submitted to the API
:rtype: dict
"""
filtered_payload = self._resource_prepare_params(resource, action, payload)
# On Python 2 dict.keys() is just a list, but we need a set here.
unsupported_parameters = set(payload.keys()) - set(_recursive_dict_keys(filtered_payload))
if unsupported_parameters:
warn_msg = "The following parameters are not supported by your server when performing {0} on {1}: {2}. They were ignored."
self.warn(warn_msg.format(action, resource, unsupported_parameters))
return filtered_payload

@evgeni
Copy link
Member Author

evgeni commented Apr 29, 2022

sanity issue is unrelated: #1393

@evgeni evgeni force-pushed the mirroring-policy branch from e97c422 to 59599bc Compare April 29, 2022 09:48
@evgeni evgeni merged commit 349455c into theforeman:develop Apr 29, 2022
@evgeni evgeni deleted the mirroring-policy branch April 29, 2022 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mirror_on_sync is deprecated
2 participants